<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=0">

		<title>发表评论</title>

		<link href="../AmazeUI-2.4.2/assets/css/admin.css" rel="stylesheet" type="text/css">
		<link href="../AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css">

		<link href="../css/personal.css" rel="stylesheet" type="text/css">
		<link href="../css/appstyle.css" rel="stylesheet" type="text/css">
		<script type="text/javascript" src="../js/vue2.5.js" ></script>
		<script type="text/javascript" src="../js/axios.min.js" ></script>
		<script type="text/javascript" src="../js/jquery-1.11.2.min.js" ></script>
		<script type="text/javascript" src="../js/global.js" ></script>
		<script type="text/javascript" src="../js/bootstrap/js/bootstrap.js" ></script>
		<script type="text/javascript" src="../js/layer/layer.js" ></script>
		<script src="../js/param.js"></script>
		
	</head>

	<body>
		
            <div class="nav-table">
					   <div class="long-title"><span class="all-goods">全部分类</span></div>
					   <div class="nav-cont">
							<ul>
								<li class="index"><a href="../index.html">首页</a></li>
								<li class="qc"><a href="text.html">推荐</a></li>
								<li class="qc"><a href="../home/search.html">搜索</a></li>
								<li class="qc"><a href="#">团购</a></li>
								<li class="qc last"><a href="about.html">我们</a></li>
							</ul>
						</div>
			</div>
			<b class="line"></b>
		<div class="center">
			<div class="col-main">
				<div class="main-wrap">

					<div class="user-comment">
						<!--标题 -->
						<div class="am-cf am-padding">
							<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">发表评论</strong> / <small>Make&nbsp;Comments</small></div>
						</div>
						<hr/>

						<div class="comment-main container">
						
							<div class="comment-list" v-for="(order,index) in orderData">
								<div class="item-pic">
									<a href="#" class="J_MakePoint">
										<img :src="baseUrl+'/goods/getgoods?gid='+ order.goods.gid" class="itempic">
									</a>
								</div>

								<div class="item-title">

									<div class="item-name">
										<a href="#">
											<p class="item-basic-info">{{order.goods.gname}}</p>
										</a>
									</div>
									<div class="item-info">
										<div class="info-little">
											<span>描述：{{order.goods.gdesc}}</span>
											
										</div>
										<div class="item-price">
											价格：<strong>{{order.goods.gprice}}元</strong>
										</div>										
									</div>
								</div>
								<div class="clear"></div>
								<div class="item-comment">
									<textarea  :id="'conetent'+index" placeholder="请写下对宝贝的感受吧，对他人帮助很大哦！"></textarea>
								</div>
								<div class="filePic">
									<input type="file" class="inputPic" allowexts="gif,jpeg,jpg,png,bmp" accept="image/*" >
									<span>晒照片(0/5)</span>
									<img src="../images/01.jpg" alt="">
								</div>
								<div class="item-opinion" :id="'satisfaction'+index">
									<li><i class="op1"></i><span>好评</span></li>
									<li><i class="op2"></i><span>中评</span></li>
									<li><i class="op3"></i><span>差评</span></li>
								</div>
							</div>
							
							
							
											
								<div class="info-btn">
									<div class="am-btn am-btn-danger" @click="send()">发表评论</div>
								</div>							
							
					
												
							
						</div>

					</div>

				</div>
				<!--底部-->
				<div class="footer">
					<div class="footer-hd">
						<p>
							
							<b>|</b>
							<a href="#">商城首页</a>
							<b>|</b>
							<a href="#">支付宝</a>
							<b>|</b>
							<a href="#">物流</a>
						</p>
					</div>
					<div class="footer-bd">
						<p>
							
							<a href="#">合作伙伴</a>
							<a href="#">联系我们</a>
							<a href="#">网站地图</a>
							<em>© 2015-2025 Hengwang.com 版权所有. 更多模板 <a href="http://www.cssmoban.com/" target="_blank" title="模板之家"></a> - Collect from <a href="http://www.cssmoban.com/" title="网页模板" target="_blank">网页模板</a></em>
						</p>
					</div>
				</div>
			</div>

			<aside class="menu">
				<ul>
					<li class="person active">
						<a href="person/index.html"><i class="am-icon-user"></i>个人中心</a>
					</li>
					<!--管理员界面-->
					<li class="person">
						<p><i class="am-icon-qq"></i>管理系统</p>
						<ul>
							<li> <a href="querygoods.html">商品管理</a></li>
							<li> <a href="queryorder.html">订单管理</a></li>		
							
						</ul>
					</li>
					<!--普通界面-->
					<li class="person">
						<p><i class="am-icon-newspaper-o"></i>个人资料</p>
						<ul>
							<li> <a href="information.html">个人信息</a></li>
							<li> <a href="safety.html">安全设置</a></li>
							<li> <a href="address.html">地址管理</a></li>
							
						</ul>
					</li>
					<li class="person">
						<p><i class="am-icon-balance-scale"></i>我的交易</p>
						<ul>
							<li><a href="order.html">订单管理</a></li>
							<li> <a href="change.html">退款售后</a></li>
							<li> <a href="comment.html">评价商品</a></li>
						</ul>
					</li>
					
					<li class="person">
						<p><i class="am-icon-tags"></i>我的收藏</p>
						<ul>
							<li> <a href="collection.html">收藏</a></li>
																		
						</ul>
					</li>
					<li class="person">
						<p><i class="am-icon-qrcode"></i>在线客服</p>
						<ul>
							<li> <a href="suggest.html">意见反馈</a></li>		
							<li> <a href="news.html">我的消息</a></li>
						</ul>
					</li>
					
				</ul>

			</aside>
		</div>
	<script>
		var orid = getParam('orid');
		var uid = localStorage.getItem('id');
		
		
		
		
		var vue = new Vue({
			el:'.container',
			data:{
				order:{},
				orderData:[],
				baseUrl:baseUrl,
				gids:[],
				contents:[],
				satisfactions:[]
			},methods:{
				query:function(){
					//查询订单
					axios.get(baseUrl + '/order/getByorid',{
						params:{
							orid:orid
						}
					})
						.then(function(response) {
							
							this.orderData = response.data;
							
						}.bind(this))
						.catch(function(error) {
							layer.msg('请求失败');
						});
					
				},
				send:function(){
					//加入选择的订单
					var x="";
					for(var i=0;i<this.orderData.length;i++){
						this.gids.push(this.orderData[i].goods.gid);
						
						this.contents.push($('#content'+i).text());
						var m = '#satisfaction'+i;
						var s = "#content"+i;
						console.log(s);
						console.log($(""+s).val());
						 x += $('#content'+i).text()+"--";
						this.satisfactions.push(this.orderData[i].goods.gid);
						/* (   $(m).children('li i').hasClass('active').siblings('span').text()  ); */
					}
					console.log(x);
					
					
					axios.post(baseUrl + '/comment/add',
							 $.param({
								 	gids:this.gids.toString(),
									satisfactions:this.satisfactions.toString(),
									contents:this.contents.toString(),
									uid:uid,
									num:this.orderData.length
								})
							
					)
						.then(function(response) {
							layer.msg('评论成功');
						}.bind(this))
						.catch(function(error) {
							layer.msg('请求失败');
						});
				}
			},
			mounted:function(){
				this.query();
				
			}	
		});
		
		
		</script>
		<script type="text/javascript">
			
			$('.comment-main').on('click','.comment-list .item-opinion li' ,function(){
				$(this).prevAll().children('i').removeClass("active");
				$(this).nextAll().children('i').removeClass("active");
				$(this).children('i').addClass("active");
				
			})
		
			
		</script>			
	</body>

</html>